﻿@model zichan.BLL.StatisticsModel.OldServerModel 
@{
    ViewBag.Title = "添加旧有资产";
}
@section Pagetitle{
    @AdminCommon.PageTitle("资产管理", "添加")
}
@section header{
    <link rel="stylesheet" type="text/css" href="/assets/global/plugins/select2/select2.css" />
    <link href="/assets/global/css/plugins.css" rel="stylesheet" type="text/css" />
}
@using (Html.BeginForm("AssetAndPutServer", "Assetes", FormMethod.Post, new { @class = "form-horizontal",@onsubmit= "return require();" }))
{
    <div class="form-body">

        @Html.AntiForgeryToken()

        @*<div class="form-group ">
            <label class="col-md-3 control-label xh">资产分类:</label>
            <div class="col-md-9">
                @Html.DropDownList("AssetClassId", (SelectList)ViewBag.AssetClassId, "资产分类", new { @class = "form-control input-large" })
                <span class="help-block">
                    @Html.ValidationMessageFor(o => o.AssetClassId)
                </span>
            </div>
        </div>*@
        <input type="hidden" name="AssetClassId" value="1" />
        <div class="form-group " id="ServerIdentity">
            <label class="col-md-3 control-label xh">资产标识:</label>
            <div class="col-md-9">
                <select name="Identitys" id="Identitys" class="form-control select2 input-large">
                    @*@if (!string.IsNullOrEmpty(@ViewBag.Identitys))
                        {
                        <option value="@ViewBag.Identitys" selected>@ViewBag.Identitys</option>
                        }*@
                    @foreach (var s in ViewBag.Identitys)
                    {
                        <option value="@s" selected>@s</option>
                    }
                </select>
            </div>
        </div>
        <div class="form-group ">
            <label class="col-md-3 control-label xh">所属公司:</label>
            <div class="col-md-9">
                @Html.DropDownList("CompanyId", (SelectList)ViewBag.CompanyId, "请选择", new { @class = "form-control input-large" })
                <span class="help-block">
                    @Html.ValidationMessageFor(o => o.CompanyId)
                </span>
            </div>
        </div>

        <div class="form-group ">
            <label class="col-md-3 control-label xh">资产名称:</label>
            <div class="col-md-9">
                @Html.TextBoxFor(o => o.Name, new { @class = "form-control input-large" })
                <span class="help-block">
                    @Html.ValidationMessageFor(o => o.Name)
                </span>
            </div>
        </div>


        @*<div class="form-group ">
            <label class="col-md-3 control-label xh">资产数量:</label>
            <div class="col-md-9">
                @Html.TextBoxFor(o => o.Number, new { @class = "form-control input-small" })
                <span class="help-block">
                    @Html.ValidationMessageFor(o => o.Number)
                </span>
            </div>
        </div>*@

        <div class="form-group ">
            <label class="col-md-3 control-label xh">采购人:</label>
            <div class="col-md-9">
                
                @Html.TextBoxFor(o=>o.BuyerName, new { @class = "form-control select2 input-small" })
                <span class="help-block">
                    @Html.ValidationMessageFor(o => o.BuyerName)
                </span>
            </div>
        </div>

        <div class="form-group ">
            <label class="col-md-3 control-label xh">采购时间:</label>
            <div class="col-md-9">
                <div class="input-group">
                    @Html.TextBoxFor(o => o.BuyTime, new { @class = "form-control input-small BuyTime" })
                    <span class="col-md-addtime BuyTime">
                        <i class="fa fa-calendar bigger-110 "></i>
                    </span>
                    <span class="help-block">
                        @Html.ValidationMessageFor(o => o.BuyTime)
                    </span>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-3 control-label xh">接收人:</label>
            <div class="col-md-9">
                @Html.TextBoxFor(o=>o.RecipientName, new { @class = "form-control select2 input-small" })
                <span class="help-block">
                    @Html.ValidationMessageFor(o => o.RecipientName)
                </span>
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-3 control-label">接收地:</label>
            <div class="col-md-9">
                @Html.TextBoxFor(o => o.CalculatedGround, new { @class = "form-control input-large" })
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-3 control-label">供应商:</label>
            <div class="col-md-9">
                @Html.TextBoxFor(o => o.Supplier, new { @class = "form-control input-large" })
            </div>
        </div>

        @*<div class="form-group">
            <label class="col-md-3 control-label">备注:</label>
            <div class="col-md-9">
                @Html.TextAreaFor(o => o.Remark, new { @class = "form-control input-large" })
            </div>
        </div>*@

        @*<input type="hidden" name="AssetId" id="AssetId" value="@ViewBag.id" />*@
       
            
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">品牌:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.Brand, new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.Brand)
                        </span>
                    </div>
                </div>
          
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">型号:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.Version, new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.Version)
                        </span>
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">序列号:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.SerialNumber, new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.SerialNumber)
                        </span>
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">U数:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.U_Number, new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.U_Number)
                        </span>
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">CPU:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.CPU, new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.CPU)
                        </span>
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">内存:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.Memory, new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.Memory)
                        </span>
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">硬盘:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.HardDisk, new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.HardDisk)
                        </span>
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">RAID卡:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.HardWareRAID, new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.HardWareRAID)
                        </span>
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">网口:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.Comb, new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.Comb)
                        </span>
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">出厂时间:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.DeliveryTime, new { @class = "form-control input-large", @placeholder = "如：2016/1/1" })
                        @*<span class="col-md-addtime DeliveryTime">
                            <i class="fa fa-calendar bigger-110 "></i>
                        </span>*@
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.DeliveryTime)
                        </span>
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">过保时间:</label>
                    <div class="col-md-9">
                        @Html.TextBoxFor(o => o.WarrantyTime, new { @class = "form-control input-large", @placeholder = "如：2016/1/1" })
                        @*<span class="col-md-addtime WarrantyTime">
                            <i class="fa fa-calendar bigger-110 "></i>
                        </span>*@
                        <span class="help-block">
                            @Html.ValidationMessageFor(o => o.WarrantyTime)
                        </span>
                    </div>
                </div>
                <div class="form-group ">
                    <label class="col-md-3 control-label">管理员:</label>
                    <div class="col-md-9 ">
                        @Html.TextBoxFor(o=>o.AdminiStratorName, new { @class = "form-control input-large" })
                        <span class="help-block">
                            @Html.ValidationMessage("AdminiStratorName")
                        </span>
                    </div>
                </div>
            <div class="form-group ">
                <label class="col-md-3 control-label xh">机房:</label>
                <div class="col-md-9">
                    @Html.DropDownList("MachineRoomId", (SelectList)ViewBag.machineRoomIds, "请选择机房", new { @class = "form-control input-large" })
                    <span class="help-block">
                        @Html.ValidationMessageFor(o => o.MachineRoomId)
                    </span>
                </div>
            </div>

            <div class="form-group " id="cabinetDrowpList">
                <label class="col-md-3 control-label xh">机柜:</label>
                <div class="col-md-9">
                    @Html.DropDownList("CabinetId", (SelectList)ViewBag.cabinetIds, "请选择机柜", new { @class = "form-control input-large" })
                    <span class="help-block">
                        @Html.ValidationMessageFor(o => o.CabinetId)
                    </span>
                </div>
            </div>
            <div id="u_NO">
                <div class="form-group ">
                    <label class="col-md-3 control-label xh">标准机架数:</label>
                    <div class="col-md-9">
                        <span style="color:red;">请选择机房/机柜</span>
                    </div>
                </div>
                <div class="form-group " >
                    <label class="col-md-3 control-label xh">剩余机架数:</label>
                    <div class="col-md-9">
                        <span style="color:red;">请选择机房/机柜</span>
                       
                    </div>
                </div>
            </div>
       
            @*<div class="form-group ">
                <label class="col-md-3 control-label xh">所属公司:</label>
                <div class="col-md-9">
                    @Html.DropDownList("CompanyId", (SelectList)ViewBag.companyIds, "请选择公司", new { @class = "form-control input-large" })
                    <span class="help-block">
                        @Html.ValidationMessageFor(o => o.CompanyId)
                    </span>
                </div>
            </div>*@
            @*<div class="form-group ">
                <label class="col-md-3 control-label xh">服务器用途:</label>
                <div class="col-md-9">
                    @Html.DropDownList("PurposeId", (SelectList)ViewBag.cabinetClassIds, "请选择用途", new { @class = "form-control input-large" })
                    <span class="help-block">
                        @Html.ValidationMessageFor(o => o.PurposeId)
                    </span>
                </div>
            </div>*@
        <div class="form-group ">
            <label class="col-md-3 control-label xh">服务器用途:</label>
            <div class="col-md-9">
                @Html.DropDownList("serverPurposeId", (SelectList)ViewBag.serverPurposeIds, "请选择用途", new { @class = "form-control select2 input-large" })
                <span class="help-block">
                    @Html.ValidationMessageFor(o => o.serverPurposeId)
                </span>
            </div>
        </div>
        <div class="form-group " id="subPurpose">

        </div>
        @*<span class="help-block">
            @Html.ValidationMessageFor(o => o.serverPurposeSubId)
        </span>*@
            <div class="form-group " id="property" style="display:none">
                <label class="col-md-3 control-label xh">资产标识:</label>
                <div class="col-md-9">
                    <select name="Property" id="Property" class="form-control select2 input-large">
                        @foreach (var s in ViewBag.Propertys)
                        {
                            <option value="@s.Value">@s.Text</option>
                        }
                    </select>
                </div>
            </div>
            <div class="form-group " id="Tproperty" style="display:none">
                <label class="col-md-3 control-label xh">资产标识:</label>
                <div class="col-md-9">
                    <select name="TProperty" id="TProperty" class="form-control select2 input-large">
                        @foreach (var s in ViewBag.TPropertys)
                        {
                            <option value="@s.Value">@s.Text</option>
                        }
                    </select>
                </div>
            </div>
            @*<div class="form-group " id="Server_Code">
                <label class="col-md-3 control-label xh">服务器编码:</label>
                <div class="col-md-9">
                    @Html.DropDownList("Code", (SelectList)ViewBag.Codes, "编码为已出库的服务器编码", new { @class = "form-control input-large" })
                    <span class="help-block">
                        @Html.ValidationMessageFor(o => o.Code)
                    </span>
                </div>
            </div>*@
            @*<div class="form-group " id="use_NO">
                <label class="col-md-3 control-label xh">占位:</label>
                <div class="col-md-9">
                    <span style="color:red;">请选择服务器编码</span>
                </div>
            </div>*@
       
       
        <div class="form-group ">
            <label class="col-md-3 control-label xh">使用者:</label>
            <div class="col-md-9">
                @Html.TextBoxFor(o => o.UserName, new { @class = "form-control select2 input-large" })
                <span class="help-block">
                    @Html.ValidationMessageFor(o => o.UserName)
                </span>
            </div>
        </div>
            <div class="form-group " id="mainIP">
                <label class="col-md-3 control-label xh">服务器主IP:</label>
                <div class="col-md-9">
                    @Html.DropDownList("IPId", (SelectList)ViewBag.ipIds, "请选择IP", new { @class = "form-control input-large" })
                    
                    <span class="help-block">
                        @Html.ValidationMessageFor(o => o.IPId)
                    </span>
                </div>
            </div>
            <div class="form-group " id="Sub_IP">
                <label class="col-md-3 control-label">服务器副IP:</label>
                <div class="col-md-9">
                    @*@Html.DropDownList("SubIPId", (SelectList)ViewBag.subIpIds, "请选择副IP", new { @class = "form-control input-large" })*@
                    <select name="SubIPId" id="SubIPId" placeholder="可多选" class="form-control input-large select2" multiple>
                        @foreach (var s in ViewBag.subIpIds)
                        {
                            <option value="@s.Value" @(Model != null &&Model.SubIPIds != null && Model.SubIPIds.Contains(s.Value) ? "selected" : "")>@s.Text</option>
                        }
                    </select>
                </div>
            </div>


            <div class="form-group">
                <label class="col-md-3 control-label">内网IP:</label>
                <div class="col-md-9">
                    @Html.TextBoxFor(o => o.IntranetIP, new { @class = "form-control input-large" })

                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label">IP反解:</label>
                <div class="col-md-9">
                    @*<input type="radio" class="D_ExceptId" id="D_ExceptId1" name="D_ExceptId" checked="checked" />无，请设计组安排<br />*@
                    @Html.RadioButtonFor(o => o.IsInverse, true, new { @checked = true })<span>是</span>
                    @Html.RadioButtonFor(o => o.IsInverse, false)<span>否</span>
                </div>
            </div>

            <div class="form-actions">
                <div class="row">
                    <div class="col-md-offset-3 col-md-9">
                        <button type="submit" class="btn green">提交</button>
                        <a href="/Assetes/Index" class="btn default">返回</a>
                    </div>
                </div>
            </div>
        </div>
}
@section footer{
    @Scripts.Render("~/bundles/jqueryval")
<script src="/assets/global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/assets/global/plugins/select2/select2.min.js"></script>
    <script src="~/assets/global/plugins/select2/select2_locale_zh-CN.js"></script>
    <script src="~/Scripts/AssetJs.js"></script>
    <script>
        var formatDateTime = function (date) {
            var y = date.getFullYear();
            var m = date.getMonth() + 1;
            var d = date.getDate();
            return y + '/' + m + '/' + d;
        };
        var currDate = 10;
        var currMonth = 10;
        var currYear = 2016;
        var dateStr = new Date(currMonth + "/" + currDate + "/" + currYear);

        $('.BuyTime').datetimepicker({
            //language: 'zh-CN',
            weekStart: 1,
            todayBtn: 0,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 0,
            endDate: formatDateTime(new Date()),
            minView: 'month',　　　　//日期时间选择器所能够提供的最精确的时间选择视图。
            format: 'yyyy/m/d'
        }).on('changeDate', function (ev) {
            $("#BuyTime").val(formatDateTime(new Date(ev.date.valueOf() - 28800000)));
        });
       
        $(function () {
            $('#SubIPId').select2({
                placeholder: "",
                allowClear: false
            });
            $('#BuyerId').select2({
                placeholder: "",
                allowClear: false

            });
            $('#Recipient').select2({
                placeholder: "",
                allowClear: false

            });
            //$("#CabinetId").trigger('change');
            $("#MachineRoomId").on("change", function () {
                var id = $(this).val();
                $("#cabinetDrowpList").load("/Common/part_cabinet?machineRoomId=" + id);
                $("#mainIP").load("/Common/part_Ip?machineRoomId=" + id);
            });
            var re = /^[0-9]+.?[0-9]*$/;
            if (re.test($("#serverPurposeId").val())) {
                var id = $("#serverPurposeId").val();
                $("#subPurpose").load("/Common/part_serverSubPurpose?purposeId=" + id);
            }
            //$("#serverPurposeId").on("change", function () {
            //    var id = $("#serverPurposeId").val();
            //    $("#subPurpose").load("/Common/part_serverSubPurpose?purposeId=" + id);
            //});
            //$("#CabinetId").on("change", function () {
            //    var id = $(this).val();
            //    $("#u_NO").load("/Common/part_PutAway?cabinetId=" + id);
            //});
        })
    </script>
    }

